package com.mtnz.njk.Controller;

import com.mtnz.njk.Service.ApplyVipManagerService;
import com.mtnz.njk.result.ResponseMessage;
import com.mtnz.njk.result.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: vip申请查看
 * @Author: FBL
 * @CreateDate: 2019\8\22 0022 9:53
 * @Version: 1.0
 */
@RestController
@RequestMapping("/vip")
@CrossOrigin
public class ApplyVipManagerController {

    @Autowired
    ApplyVipManagerService applyVipManagerService;

    /**
     * vip申请查看
     *
     * @param applyStatus
     * @param serviceId
     * @param key
     * @param pageNum
     * @param pageSize
     * @return
     * @throws Exception
     */
    @PostMapping("/listApplyVip")
    public ResponseResult listApplyVip(Integer applyStatus, String serviceId, String key, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) throws Exception {
        return applyVipManagerService.listApplyVip(applyStatus,serviceId,key,pageNum,pageSize);
    }

    /**
     * 拒绝提交或者提交审核或者审核拒绝或者审核通过
     *
     * @param applyStatus  1 审核通过 2 申请中 3 被拒提交 4 提交 （审核中）
     * @param applyVipId
     * @return
     * @throws Exception
     */
    @PostMapping("/auditApplyVip")
    public ResponseResult auditApplyVip(Integer applyStatus,String applyVipId,String productIds) throws Exception {
        if(applyStatus == null || applyVipId == null || ("").equals(applyVipId))
            return new ResponseResult(ResponseMessage.FAIL);
        return applyVipManagerService.auditApplyVip(applyStatus,applyVipId,productIds);
    }
}
